package com.fouram.web.controller;

import com.fouram.core.domain.R;
import com.fouram.web.base.BaseController;
import com.fouram.web.utils.InvokeCodeUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 动态代码接口
 * @author fouram
 */
@Api(tags = "动态代码接口")
@RestController
@RequestMapping("/dynamicCode")
public class DynamicCodeController extends BaseController {

    @ApiOperation("执行")
    @GetMapping("/execute")
    public Object execute(@RequestParam String req, @RequestParam String dynamicCode, @RequestParam String classFullName) throws Exception {
        InvokeCodeUtils.runCode(req, dynamicCode, classFullName);
        return R.ok();
    }
}
